const app = getApp();
var config = app.globalData.config;
const http = require('../../utils/http.js');
var WxParse = require('../../wxParse/wxParse.js');

Page({

	data: {
		weekmeal_id: 0,
		weekmeal_data: [],
		_article : ''
	},
	onReady() {
		if (!app.login()) {
			return;
		}
	},
	onLoad(options) {
		this.data.weekmeal_id = options.id;
		this.setData({
			'weekmeal_id': options.id
		});
		this.getWeekmealDetail();
	},
	getWeekmealDetail() { //获取菜品详情
		var that = this;
		var _weekmeal_id = that.data.weekmeal_id;
		var _content = "";
		
		http.httpPost(config.getFoodDetail, {
			weekmeal_id: _weekmeal_id
		}, function(e) {
			if(e.code){
				that.data.weekmeal_data = e.data;
				that.setData({
					'weekmeal_data': e.data
				});
				_content = e.data.mcontent;
			
				WxParse.wxParse('article', 'html', _content, that);
			}
		});

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow() {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload() {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh() {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage() {

	}
})
